package com.atguigu.dao;

import com.atguigu.base.BaseController;
import com.atguigu.base.BaseDAO;
import com.atguigu.entity.UserFollow;
import com.atguigu.vo.UserFollowVo;
import com.github.pagehelper.Page;
import com.github.pagehelper.PageInfo;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.PathVariable;

/**
 * @PACKAGE_NAME: com.atguigu.dao
 * @CLASSNAME: UserFollowDAO
 * @AUTHOR: zhangsan
 * @DATE: 2024/4/29 15:52
 * @SINCE 17.0.7
 * @DESCRIPTION: UserFollowDAO
 */
public interface UserFollowDAO extends BaseDAO<UserFollow> {

    /**
     * 通过用户id,查询该用户的关注列表
     * @param id
     * @return
     */
    Page<UserFollowVo> findListPage(@Param("userId") Long userId);

    /**
     * 通过用户id和房源id,查询该用户是否关注了该房源
     * @param userId
     * @param houseId
     * @return
     */
    Integer countByUserIdAndHouseId(@Param("userId") Long userId,
                                    @Param("houseId") Long houseId);

    /**
     * 通过用户id和房源id,查询该用户是否关注过该房源
     * @param userId
     * @param houseId
     * @return
     */
    UserFollow getByUserIdAndHouseId(@Param("userId") Long userId,
                                     @Param("houseId") Long houseId);

    /**
     * 将userFollow的is_deleted字段改为0
     * @param userFollow
     * @return
     */
    Integer updateIsDeleted(UserFollow userFollow);
}
